package me.minecraft.mod.cobblemonbukkitevent.bukkit.event;

import com.cobblemon.mod.common.api.battles.model.PokemonBattle;
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon;
import com.cobblemon.mod.common.item.battle.BagItem;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
 * @author langle__
 * @version 1.0
 */
public class ItemUsedEvent extends Event implements Cancellable {

    private static final HandlerList HANDLERS = new HandlerList();

    private final PokemonBattle battle;
    private final BattlePokemon target;
    private final BagItem item;
    private final boolean after;

    private boolean cancel;

    public ItemUsedEvent(PokemonBattle battle, BattlePokemon target, BagItem item, boolean after) {
        this.battle = battle;
        this.target = target;
        this.item = item;
        this.after = after;
    }

    public PokemonBattle getBattle() {
        return battle;
    }

    public BattlePokemon getTarget() {
        return target;
    }

    public BagItem getItem() {
        return item;
    }

    public boolean isAfter() {
        return after;
    }

    @Override
    public boolean isCancelled() {
        return cancel;
    }

    @Override
    public void setCancelled(boolean cancel) {
        this.cancel = cancel;
    }

    @Override
    public @NotNull HandlerList getHandlers() {
        return HANDLERS;
    }

    public static HandlerList getHandlerList() {
        return HANDLERS;
    }

}
